function deepJson(jsonNode, callback) {
	for (let node of jsonNode) {
		callback(node);
		if (node.children && node.children.length !== 0) {
			deepJson(node.children, callback);
		}
	}
}
function resolveAttr(node, attr, value) {
	if (node.attributes === undefined || node.attributes === []) {
		node.attributes = [];
		node.attributes.push({
			key: attr,
			value: value,
		});
	} else {
		let flag = 0;
		for (attribute of node.attributes) {
			// 处理 class
			if (attribute.key === attr && attr === "class") {
				attribute.value += ` ${value}`;
				flag = 1;
			}
		}
		if (!flag) {
			node.attributes.push({
				key: attr,
				value: value,
			});
		}
	}
}
module.exports = { deepJson, resolveAttr };
